package com.pb.b2b.bean;

import java.io.Serializable;

import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;

import org.springframework.stereotype.Component;

/**
 * @author apinar
 */

@Component
@ApplicationScoped
@ManagedBean(name = "applicationBean")
public class ApplicationBean implements Serializable {
	private static final long serialVersionUID = 1L;
	private String contextRoot = null;

	// private static String fs = "/"; // File.separator;

	public String getCssTheme() {
		return getThemeFileName();
	}

	public String getThemeFileName() {
		return "mystil";
	}

	public String getThemeImagePath() {
		return "/resources/css/" + getThemeFileName() + "/img/";
	}

	public String getContextRoot() {
		if (contextRoot == null) {
			contextRoot = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
		}
		return contextRoot;
	}

	/**
	 * kontrol edilecek
	 */

	// public String getImagePathLocale() {
	// Locale locale = new Locale("TR");
	// String imagePath = ":resources:images:" + getThemeFileName() + ":" +
	// locale.toString() + ":";
	// return imagePath.replace(':', '/');// File.separatorChar);
	// }

	// public String getImagePath() {
	// return "/resources/images/" +
	// FacesUtils.getUserSession().getLocale().toString() + "/";
	// }

	// public String getImagePath() {
	// String imagePath = ":resources:images:" + getThemeFileName() + ":";
	// return imagePath.replace(':', '/');// File.separatorChar);
	// }

	// public String getDate() {
	// DateTime date = new DateTime();
	// DateTimeFormatter fmt =
	// DateTimeFormat.forPattern("dd/MM/yyyy - HH:mm:ss");
	// return date.toString(fmt);
	// }

}
